package com.spring.demo.init.httpinvoker;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter;

import com.spring.demo.core.httpinvoker.HttpUserService;
import com.spring.demo.core.httpinvoker.IHttpUserService;

/**
 * http invoker server config
 * 
 * @author sean
 * 
 */
@Configuration
public class HttpServerConfig {

	@Bean
	public IHttpUserService httpUserService() {
		return new HttpUserService();
	}

	@Bean(name = "httpInvokerServiceExporter")
	@Autowired
	public HttpInvokerServiceExporter httpInvokerServiceExporter(
			IHttpUserService httpUserService) {
		HttpInvokerServiceExporter exporter = new HttpInvokerServiceExporter();
		exporter.setServiceInterface(IHttpUserService.class);
		exporter.setService(httpUserService);

		return exporter;
	}
}
